<?php
namespace app\api\controller;
use app\common\controller\BaseApi;

/* 获取店铺配置代码 */
class ShopConfigApi extends  BaseApi
{
	public function _initialize()
    {
    }
	
	/**
	 * http://SmartGYM.com/api/ShopConfigApi/GetConfig/shop_code/123654987/access_type/1
	 * 获取店铺配置
	 * @param $access_type 访问类型  1客户端访问 
	 * @param $shop_code 店铺代码
	 */
	function GetConfig(){
		$shop_code=input('shop_code/s');
		$access_type=input("access_type/d");
		if(empty($shop_code)||strlen($shop_code)<5){
			$this->ajax_error('','0003','无效的店铺代码');
		}else{
			$config=db("PcConfig")->where("shop_code='".$shop_code."'")->find();
			if(empty($config)){
				$this->ajax_error('','0003','无效的店铺代码');
			}else{
				$data=array(
				    "server_url"=>$config["server_url"],
					"shop_id"=>$config["shop_id"],
					"browser"=>$config["browser"],
					"pic_version"=>$config["pic_version"],
					"locker_version"=>$config["locker_version"],
					"card_keys"=>$config['card_keys'],
					"auto_key"=>$config['is_locker'],
					"shop_code"=>$config['shop_code'],
					"gym_type"=>$config['gym_type'],
					"off_line"=>$config['off_line'],
					"off_line_in"=>$config['off_line_in'],
					"model_count"=>$config['model_count'],
                    "reader_version" => $config['reader_version'],
                    "model_store_type" => $config['model_store_type']
				);
				$this->ajax_success($data);
			}
		}
		 
	}
	

	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}
